<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{common/import :: tophead}">
    <title>Blogs</title>
</head>
<body>
<div th:replace="~{common/topBar :: nav}"></div>
<div class="container-fluid main" id="contentMain">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <h3><span class="glyphicon glyphicon-list" aria-hidden="true"></span> 发现</h3>
            <ul class="nav nav-tabs visible-lg">
                <li role="presentation" th:class="${sort == null ||sort == 'new' || sort == '' ? 'active':''}">
                    <a th:href="@{/(sort='new')}">最新</a>
                </li>
                <li role="presentation" th:class="${sort == 'hot' ? 'active':''}">
                    <a th:href="@{/(sort='hot')}">最热</a>
                </li>
                <li role="presentation" th:class="${sort == 'hot7' ? 'active':''}">
                    <a th:href="@{/(sort='hot7')}">7天最热</a>
                </li>
                <li role="presentation" th:class="${sort == 'hot30' ? 'active':''}">
                    <a th:href="@{/(sort='hot30')}">30天最热</a>

                </li>
            </ul>
            <div class="row hidden-lg">
                <li class="dropdown pull-right phone-sortQuestion">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        <span th:text="${sortName}">排序</span>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a th:href="@{/(sort='new',sortName='最新')}">最新</a></li>
                        <li><a th:href="@{/(sort='hot',sortName='最热')}">最热</a></li>
                        <li><a th:href="@{/(sort='hot7',sortName='7天最热')}">7天最热</a></li>
                        <li><a th:href="@{/(sort='hot30',sortName='30天最热')}">30天最热</a></li>
                    </ul>
                </li>
            </div>

            <div class="media" th:each="blog : ${allBlogs.list}">
                <div class="media-left">
                    <a th:href="@{'/blog/' + ${blog.id}}">
                        <img class="media-object img-rounded"
                             th:src="${blog.user.avatar_url}">
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading">
                        <a th:href="@{'/blog/' + ${blog.id}}" th:text="${blog.title}"></a>
                    </h4>
                    <span class="text-desc">
                        <span th:text="${blog.description}"></span><br>

                        <!-- 标签项-->

                        <span class="pull-right" style="padding-top: 5px">
                            <span th:text="${blog.view_count}"></span>次浏览·
                            <span th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd HH:mm')}"></span>
                        </span>
                    </span>
                </div>
            </div>

            <nav aria-label="Page navigation" th:if="${allBlogs.pages}>1" class="pull-right">
                <ul class="pagination">
                    <li th:if="!${allBlogs.isFirstPage}">
                        <a th:href="@{/(page=${allBlogs.pageNum - 1},search=${search},tag=${tag},sort=${sort})}"
                           aria-label="Previous">
                            <span aria-hidden="true">&lt;</span>
                        </a>
                    </li>

                    <li th:each="page : ${allBlogs.navigatepageNums}" th:class="${allBlogs.pageNum == page}? 'active' : ''">
                        <a th:href="@{/(page=${page},search=${search},tag=${tag},sort=${sort})}" th:text="${page}"></a>
                    </li>

                    <li th:if="!${allBlogs.isLastPage}">
                        <a th:href="@{/(page=${allBlogs.pageNum +1 },search=${search},tag=${tag},sort=${sort})}"
                           aria-label="Previous">
                            <span aria-hidden="true">&gt;</span>
                        </a>
                    </li>
                </ul>
            </nav>

        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <!--相关问题-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <h4 style="margin-bottom: 0.5em;">
                    <img th:src="@{images/hot.svg}" class="nav-title-icon">
                    热门标签
                </h4>

                <!--推荐内容-->
                <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <h4>
                    <img th:src="@{images/bookmark.svg}" class="nav-title-icon">
                    推荐内容
                </h4>
                <div>
                    <!--<img src="/images/coder.jpg" class="img-thumbnail">-->
                    <img class="index-gif" th:src="@{images/mysql.gif}">
                </div>
            </div>
        </div>
    </div>
</div>
<div th:replace="~{common/footer :: foot}"></div>
</body>
</html>